package com.renli.bean;

import lombok.Data;

@Data
public class ResultJson<T> {
    private String  code;//200  404  500   200 有数据 没数据
    private String msg;
    private Long  count;
    private  T  data;

    public  ResultJson setSuccess(String msg){
        //new
        this.msg=msg;
        this.code="200";
        return   this;
    }
    public  ResultJson setSuccess(String msg,T data){
        this.msg=msg;
        this.data=data;
        return   this;
    }
    public  ResultJson setSuccess(String msg,String code){
        this.msg=msg;
        this.code=code;
        return   this;
    }
    public  ResultJson setSuccess(String msg,T data,Long  count){
        this.msg=msg;
        this.data=data;
        this.count=count;
        return   this;
    }
    public  ResultJson setFail(String msg){
        //new
        this.msg=msg;
        this.code="-1";
        return   this;
    }


    public String getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public Long getCount() {
        return count;
    }

    public T getData() {
        return data;
    }
}
